//通过UUID给用户生成临时身份
import { v4 as uuidv4 } from 'uuid';

//封装一个函数:持久化存储用户临时身份[只是生成一次]
export const getUserTempId = () => {
    let userId = localStorage.getItem('USER_ID');
    if (!userId) {
        userId = uuidv4();
        localStorage.setItem('USER_ID', userId);
    }
    return userId;
}